package com.pilipili.service;

import com.pilipili.dao.userMapper;
import com.pilipili.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class userServiceImpl implements userService{

    @Autowired
    userMapper userMapper;

    @Override
    @Cacheable(value = "User")
    public List<User> selectUser(User user) {
        return userMapper.selectUser(user);
    }

    @Override
    @CacheEvict(value="User", allEntries=true)
    public int insertUser(User user) {
        return userMapper.insertUser(user);
    }

    @Override
    @CacheEvict(value="User", allEntries=true)
    public int updateUser(User user) {
        return userMapper.updateUser(user);
    }

    @Override
    @CacheEvict(value="User", allEntries=true)
    public int deleteUser(String user_id) {
        return userMapper.deleteUser(user_id);
    }
}
